import {request} from "./request";

export function findAll(data) {
  return request({
    url: '/user/findAll',
    params:
      {
        "pageNo": data.pageNo,
        "pageSize": data.pageSize
      },
      // data,
    method: 'post'
  })
}


export function findById(data) {
  return request({
    url: '/user/findOne',
    params:
      {
        id: data
      },
      // data,
    method: 'post'
  })
}

export function findByUsername(data) {
  return request({
    url: '/user/findByName',
    params:
      {
        realName: data
      },
      // data,
    method: 'post'
  })
}


export function add(user) {
  return request({
    url: '/user/add',
    data:{
      realName:user.realName,
      age: user.age,
      address: user.address,
      tel: user.tel,
      sex: user.sex,
      role: user.role,
      password: user.password,
      username: user.username,
    },
    // data,
    method: 'post'
  })
}

export function edit(data) {
  return request({
    url: '/user/edit',
    params:
      {
        realName: data
      },
    // data,
    method: 'post'
  })
}

export function del(id) {
  return request({
    url: '/user/del',
    params:
      {
        id: id
      },
    // data,
    method: 'post'
  })
}



